import java.util.HashMap;
import java.util.Hashtable;
import java.util.Scanner;

/**
 * @Author YuanYuan
 * @Date 2022/7/13
 * @Time 15:01
 */
public class TestDemo {

    public static void charAll(String str) {
        HashMap<Character,Integer> hashMap= new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            if(!hashMap.containsKey(str.charAt(i))) {
                hashMap.put(str.charAt(i),i);
                System.out.print(str.charAt(i));
            }
        }
    }
    public static void charAll1(String str) {
        char[] arr = new char[50];
        for (int i = 0; i < str.length(); i++) {
            int src = (int)str.charAt(i) - (int)'a';
            if(arr[src]!=str.charAt(i)) {
                arr[src] = str.charAt(i);
                System.out.print(str.charAt(i));
            }
        }
    }
    public static void merge(int a[], int m, int b[], int n) {

        int alen = m-1;
        int blen = n-1;
        int k = m+n-1;
        while (alen>=0&&blen>=0) {
            if(a[alen]<b[blen]) {
                a[k--] = b[blen--];
            }else {
                a[k--] = a[alen--];
            }
        }
        while(blen>=0) {
            a[k--] = b[blen--];
        }

    }
    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNext()) {
//            String str = scanner.nextLine();
//            charAll1(str);
//        }
        int[] arr1 = new int[7];
        int[] arr2 = {1,2,3,7};
        arr1[0] = 4;
        arr1[1] = 5;
        arr1[2] = 6;
        merge(arr1,3,arr2,4);
        for (int i = 0; i < arr1.length; i++) {
            System.out.println(arr1[i]);
        }
    }
}
